<!--  -->
<template>
<div>
  <div style="padding: 10px 20px;">
    <div class="font16">请选择该用户被禁言时间!</div>
    <div class="font14 graytext">注意:在禁言时间内用户只能浏览论坛内信息</div>
  </div>
  <van-divider :style="{  borderColor: '#ebedf0',margin: '0px' ,borderWidth: '1px 0 0'}"></van-divider>
  <van-radio-group v-model="radio" style="margin-left:10px">
    <van-radio name="1" style="margin:15px"><span class="font16">10天</span></van-radio>
    <van-divider :style="{  borderColor: '#ebedf0',margin: '0px 0px 0px 36px' ,borderWidth: '1px 0 0'}"></van-divider>
    <van-radio name="2" style="margin:15px"><span class="font16">1个月</span></van-radio>
    <van-divider :style="{  borderColor: '#ebedf0',margin: '0px 0px 0px 36px' ,borderWidth: '1px 0 0'}"></van-divider>
    <van-radio name="3" style="margin:15px"><span class="font16">永久禁言</span></van-radio>
    <van-divider :style="{  borderColor: '#ebedf0',margin: '0px 0px 0px 36px' ,borderWidth: '1px 0 0'}"></van-divider>
  </van-radio-group>
  <div style="display:flex;justify-content:center;margin-top:50px">
    <van-button @click="tobidden()"  color="#F06F3F" style="width:85%">确定</van-button>
  </div>

</div>
  
</template>

<script>
import { mapGetters } from "vuex";
import { Notify,Toast } from "vant";
import {forbiddenByName} from "@/api/colorfulLife.js";
  export default {
    components: {

    },
    data() {
       return {
         radio: '1',
         oaAccount:'',
       }
    },
    computed: {
      ...mapGetters(["user"]),
    },  
    //生命周期--创建完成
    activated() {
      this.oaAccount = this.$route.query.oaAccount
    },
    //生命周期--挂载完成
    mounted() {

    },
    //方法调用
    methods: {
      tobidden(){
        var prohibitionTime=''
        if(this.radio=='1'){
          prohibitionTime='ten'
        }else if(this.radio=='2'){
          prohibitionTime='month'
        }else if(this.radio=='3'){
          prohibitionTime='forever'
        }
        var params = {
          userName: this.user.userName,
          name: this.oaAccount,
          prohibitionTime: prohibitionTime,
        };
        forbiddenByName(params).then((result) => {
          if(!result.data){
              Notify(result.message);
              return;
          }
          if(result.data.status=='200'){
            this.$router.back(-1); //返回上一页
            localStorage.setItem('getnewuserdata', 'getnewuserdata')
          }else{
            Notify(result.message);
            return;
          }
        })
      }
    }
  }
</script>
<style  scoped>
/* @import url();*/
</style>